package net.mcreator.servercmd.procedure;

import net.minecraft.world.World;
import net.minecraft.entity.Entity;

import net.mcreator.servercmd.ServerCmdModVariables;
import net.mcreator.servercmd.ElementsServerCmdMod;

import java.util.Map;

@ElementsServerCmdMod.ModElement.Tag
public class ProcedureSetspawnCmd extends ElementsServerCmdMod.ModElement {
	public ProcedureSetspawnCmd(ElementsServerCmdMod instance) {
		super(instance, 11);
	}

	public static void executeProcedure(Map<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			System.err.println("Failed to load dependency entity for procedure SetspawnCmd!");
			return;
		}
		if (dependencies.get("world") == null) {
			System.err.println("Failed to load dependency world for procedure SetspawnCmd!");
			return;
		}
		Entity entity = (Entity) dependencies.get("entity");
		World world = (World) dependencies.get("world");
		if ((entity.canUseCommand((int) 4, ""))) {
			ServerCmdModVariables.MapVariables
					.get(world).SpawnSave = (String) (((entity.posX)) + "" + (" ") + "" + ((entity.posY)) + "" + (" ") + "" + ((entity.posZ)));
			ServerCmdModVariables.MapVariables.get(world).syncData(world);
		}
	}
}
